#include "component.h"

Component::Component(const QString& name, QObject* parent)
    : QObject(parent), m_name(name)
{
    // 默认位置
    static int count = 0;
    m_position = QPointF(100 + (count % 4) * 200, 100 + (count / 4) * 150);
    count++;
}

QString Component::getName() const {
    return m_name;
}

QIcon Component::getIcon() const {
    return m_icon;
}

QPointF Component::getPosition() const {
    return m_position;
}

double Component::getPower() const {
    return m_power;
}

void Component::setPower(double value) {
    m_power = value;
}

void Component::modifyParameters() {
    // 在实际应用中会弹出对话框
    // 这里仅作为基类空实现
}
